﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using Cherry.Agile.FileHandling;
using System.IO;
using Cherry.Agile.Logging;

namespace Cherry.Agile.RpcService.ExtProcessor
{
    /// <summary>
    /// 向平台系统日志写异常日志的记录的扩展插件。
    /// </summary>
    public class RpcSystemErrorLog : IServiceExtentProcessor
    {
        /// <summary>
        /// 开始处理
        /// </summary>
        /// <param name="context"></param>
        public void ProcessOnStarting(ProcessContext context)
        {
            ;
        }



        /// <summary>
        /// 结束处理
        /// </summary>
        /// <param name="context"></param>
        public void ProcessOnEnding(ProcessContext context)
        {
            ;
        }

        /// <summary>
        /// 跟踪异常信息
        /// </summary>
        /// <param name="ex">异常信息</param>
        public void ProcessTrace(Exception ex, ProcessContext context)
        {

            string msg = string.Format("{0}\r\n{1}\r\n{2}\r\n\r\n", context, ex.Message,ex.StackTrace);
            ILogger loger = LoggingManager.GetLogger("RpcService");
            loger.Fatal(msg);
        }

        /// <summary>
        /// 跟踪信息输出
        /// </summary>
        /// <param name="traceMessage"></param>
        public void ProcessTrace(string traceMessage, ProcessContext context)
        {

        }
    }
}
